<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible"content="IE=8"><!--以IE8模式渲染-->
	<meta http-equiv="X-UA-Compatible"content="IE=7"><!--以IE7模式渲染-->
	<meta http-equiv="X-UA-Compatible"content="IE=9; IE=8; IE=7; IE=EDGE">
	<title>员工新增</title>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/demo.css">
	<script type="text/javascript" src="__PUBLIC__/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery_city/jquery.cityselect.js"></script>

	<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/long_add.css" >
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/jquery.alert.v1.2/jquery.alert.css"/>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/autocomplete/jquery.autocomplete.css" >
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/jquery_validate/css/validationEngine.jquery.css" >
	<!-- // <script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.0.min.js"></script> -->
	<script type="text/javascript" src="__PUBLIC__/js/jquery_validate/js/jquery.validationEngine.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery_validate/js/jquery.validationEngine-zh_CN.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.alert.v1.2/jquery.easydrag.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.alert.v1.2/jquery.alert.js"></script>
	<!-- // <script type="text/javascript" src="__PUBLIC__/js/My97DatePickerBeta/WdatePicker.js"></script> -->
	<script type="text/javascript" src="__PUBLIC__/js/ajax.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/autocomplete/jquery.autocomplete.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>

	<style>
		#communication select 
		{
			width:130px;
		}
		#live select 
		{
			width:130px;
		}
		#company select 
		{
			width:130px;
		}
		#linkman select 
		{
			width:130px;
		}

		.listrate 
		{
			border-top:1px solid #000000;
			border-left:1px solid #000000;
			border-bottom:1px solid #000000;
			border-spacing:0;
			width: 100%;
			table-layout: fixed;
		}
		.listrate th 
		{
			background-color:#5cb85c;
			line-height:24px;
			color:#fff;
		}
		.listrate th,.listrate td 
		{
			border-right:1px solid #000000;
			text-align:center;
		}
		.listrate th
		{
			padding:5px;
		}
		.listrate td
		{
			padding:4px;
		}
		.listrate input[type="checkbox"]
		{
			vertical-align: middle;
		}
		.listrate td input
		{
			outline: medium;
		}
		.listrate .list_action
		{
			width: 170px;
		}
		.listrate td input[type="text"]
		{
			height: 22px;
			line-height:22px;
			border: none;
			border-radius:4px;
			text-align: center;
			width: 90%;
			background-color: transparent;
		}
		.listrate td input[type="button"]
		{
			border: 1px solid #000000;
			background-color:#6D654E;
			color:#fff;
			text-align:center;
			padding: 2px 10px 3px;
			border-radius: 4px;
		}
	</style>
</head>

<body>
	<div style="margin:20px 0;"></div>
	<div class="easyui-tabs" data-options="tabWidth:163">
		<div title="基本信息" style="padding:10px">
			<form action="../../facilitator/facilitator/baseinfo_submit" method="post" id="form_baseinfo">
				<input type="hidden" name="baseinfo" value="<?php echo $data; ?>">
				<input type="hidden" name="facilitator_info_id" value="<?php echo $facilitator_info_id; ?>">
				<h1>基本信息</h1>
				<table class="addForm">
					<tr>
						<td class="content-n">经营类别：</td>
						<td class="content-d">
							<select class="form-control" name="man_type_id">
								<option value="">请选择经营类别</option>
								<?php
									foreach ($array_managementType as $key => $value) 
									{
										if ($value['man_type_id'] == $result['man_type_id']) 
										{
											echo "<option value=" . $value['man_type_id'] . " selected>" . $value['man_type'] . "</option>";
										}
										else
										{
											echo "<option value='".$value['man_type_id']."'>".$value['man_type']."</option>";
										}
									}
								?>
							</select>
						</td>
					</tr>
					<tr>
						<td class="content-n">商户全称：</td>
						<td class="content-d">
							<?php
								if ($result['fac_name']) 
								{
									$fac_name = $result['fac_name'];
								}
								else
								{
									$fac_name = $data_shopby['merchant_name'];
								}
							?>
							<input type="text" name="fac_name" value="<?php echo $fac_name?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">商户简称：</td>
						<td class="content-d">
							<?php
								if ($result['fac_simple_name']) 
								{
									$fac_simple_name = $result['fac_simple_name'];
								}
								else
								{
									$fac_simple_name = $data_shopby['merchant_abbreviation'];
								}
							?>
							<input type="text" name="fac_simple_name" value="<?php echo $fac_simple_name?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">服务分类：</td>
						<td class="content-d">
							<select class="form-control" name="fac_separatetype">
								<option value="">请选择服务分类</option>
								<?php
									foreach ($array_facilitatorItype as $key => $value) 
									{
										if ($value['trade_number'] == $result['fac_separatetype']) 
										{
											echo "<option value=" . $value['trade_number'] . " selected>" . $value['name'] . "</option>";
										}
										else
										{
											echo "<option value='".$value['trade_number']."'>".$value['name']."</option>";
										}
									}
								?>
							</select>
						</td>
					</tr>
					<tr>
						<td class="content-n">证照类型：</td>
						<td class="content-d">
							<input type="text" name="fac_licence_type" value="<?php echo $result['fac_licence_type']?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">证照号码：</td>
						<td class="content-d">
							<input type="text" name="fac_licence_number" value="<?php echo $result['fac_licence_number']?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">官网地址：</td>
						<td class="content-d">
							<input type="text" name="fac_officialaddress" value="<?php echo $result['fac_officialaddress']?>" />
						</td>
					</tr>
					<tr>
						<td class="addButton" colspan="2">
							<input type="submit" class='save' value ="保存" >
							<input type='button' value='重置'  class='clear' onclick='window.location.reload();'>
						</td>
					</tr>
				</table>
			</form>
		</div>

		<div title="官网信息" style="padding:10px">
			<form action="../../facilitator/facilitator/siteinfo_submit" method="post" id="form_siteinfo" enctype="multipart/form-data">
				<input type="hidden" name="siteinfo" value="<?php echo $data; ?>">
				<input type="hidden" name="facilitator_info_id" value="<?php echo $facilitator_info_id; ?>">
				<h1>官网信息</h1>
				<table class="addForm" style="width:auto;">
					<tr>
						<td class="content-n">商户简介：</td>
						<td class="content-d">
							<textarea name="fac_introduction" style="height:100px;"><?php echo $result["fac_introduction"]?></textarea>
						</td>
					</tr>
					<tr>
						<td class="content-n">商户电话：</td>
						<td class="content-d">
							<input type="text" name="fac_showphone" value="<?php echo $result['fac_showphone']?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">商户地址：</td>
						<td class="content-d">
							<input type="text" name="fac_showaddress" value="<?php echo $result['fac_showaddress']?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">商户logo：</td>
						<?php
							if ($result['fac_pic']) 
							{
						?>
						<td><input name="fac_pic_name" readonly value="<?php echo $result['fac_pic'];?>" type="text"></td>
						<td>
							修改图片<input type='file' name='fac_pic'>
						</td>
						<?php
							}
							else
							{
						?>
						<td class="content-d">
							<input type='file' name='fac_pic'>
						</td>
						<?php
							}
						?>
					</tr>
					<tr>
						<td class="content-n">商户app 图片：</td>
						<?php
							if ($result['fac_app_pic']) 
							{
						?>
						<td><input name="fac_app_pic_name" readonly value="<?php echo $result['fac_app_pic'];?>" type="text"></td>
						<td>
							修改图片<input type='file' name='fac_app_pic'>
						</td>
						<?php
							}
							else
							{
						?>
						<td class="content-d">
							<input type='file' name='fac_app_pic'>
						</td>
						<?php
							}
						?>
					</tr>
					<tr>
						<td class="addButton" colspan="2">
							<input type="submit" class='save' value ="保存" >
							<input type='button' value='重置'  class='clear' onclick='window.location.reload();'>
						</td>
					</tr>
				</table>
			</form>
		</div>

		<div title="联系信息" style="padding:10px">
			<form action="../../facilitator/facilitator/links_submit" method="post" id="form_links">
				<input type="hidden" name="links" value="<?php echo $data; ?>">
				<input type="hidden" name="facilitator_info_id" value="<?php echo $facilitator_info_id; ?>">
				<h1>联系信息</h1>
				<table class="addForm">
					<tr>
						<td class="content-n">法人：</td>
						<td class="content-d">
							<?php
								if ($result['fac_corporation']) 
								{
									$fac_corporation = $result['fac_corporation'];
								}
								else
								{
									$fac_corporation = $data_shopby['corporates'];
								}
							?>
							<input type="text" name="fac_corporation" value="<?php echo $fac_corporation ?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">法人联系电话：</td>
						<td class="content-d">
							<?php
								if ($result['fac_corporation_phone']) 
								{
									$fac_corporation_phone = $result['fac_corporation_phone'];
								}
								else
								{
									$fac_corporation_phone = $data_shopby['corporate_phone'];
								}
							?>
							<input type="text" name="fac_corporation_phone" value="<?php echo $fac_corporation_phone?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">法人邮箱：</td>
						<td class="content-d">
							<?php
								if ($result['fac_corporation_email']) 
								{
									$fac_corporation_email = $result['fac_corporation_email'];
								}
								else
								{
									$fac_corporation_email = $data_shopby['corporate_email'];
								}
							?>
							<input type="text" name="fac_corporation_email" value="<?php echo $fac_corporation_email?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">商户联系人：</td>
						<td class="content-d">
							<?php
								if ($result['fac_contact']) 
								{
									$fac_contact = $result['fac_contact'];
								}
								else
								{
									$fac_contact = $data_shopby['principal'];
								}
							?>
							<input type="text" name="fac_contact" value="<?php echo $fac_contact?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">商户联系电话：</td>
						<td class="content-d">
							<?php
								if ($result['fac_contactphone']) 
								{
									$fac_contactphone = $result['fac_contactphone'];
								}
								else
								{
									$fac_contactphone = $data_shopby['principal_phone'];
								}
							?>
							<input type="text" name="fac_contactphone" value="<?php echo $fac_contactphone?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">商户联系邮箱：</td>
						<td class="content-d">
							<?php
								if ($result['fac_contactmailbox']) 
								{
									$fac_contactmailbox = $result['fac_contactmailbox'];
								}
								else
								{
									$fac_contactmailbox = $data_shopby['principal_email'];
								}
							?>
							<input type="text" name="fac_contactmailbox" value="<?php echo $fac_contactmailbox?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">商户座机：</td>
						<td class="content-d">
							<input type="text" name="fac_phone" value="<?php echo $result['fac_phone']?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">商户邮箱：</td>
						<td class="content-d">
							<input type="text" name="fac_email" value="<?php echo $result['fac_email']?>" />
						</td>
					</tr>
					<tr id="city">
						<td class="content-n">省，市：</td>
						<td class="content-d">
							<select name='fac_province' class="prov"></select>
							<select name='fac_city' class="city"><option value="">请选择</option></select>
						</td>
					</tr>
					<tr>
						<td class="content-n">详细地址：</td>
						<td class="content-d">
							<input type="text" name="fac_address" value="<?php echo $result['fac_address']?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">签约状态：</td>
						<td class="content-d">
							<select class="form-control" name="sign_type_id">
								<option value="">请选择服务分类</option>
								<?php
									foreach ($array_signState as $key => $value) 
									{
										if ($value['state_id'] == $result['sign_type_id']) 
										{
											echo "<option value=" . $value['state_id'] . " selected>" . $value['state'] . "</option>";
										}
										else
										{
											echo "<option value='".$value['state_id']."'>".$value['state']."</option>";
										}
									}
								?>
							</select>
						</td>
					</tr>
					<tr>
						<td class="addButton" colspan="2">
							<input type="submit" class='save' value ="保存" >
							<input type='button' value='重置'  class='clear' onclick='window.location.reload();'>
						</td>
					</tr>
				</table>
			</form>
		</div>

		<div title="银行账号信息" style="padding:10px">
			<form action="../../facilitator/facilitator/bankinfo_submit" method="post" id="form_bankinfo">
				<input type="hidden" name="bankinfo" value="<?php echo $data; ?>">
				<input type="hidden" name="facilitator_info_id" value="<?php echo $facilitator_info_id; ?>">
				<h1>银行账号信息</h1>
				<table class="addForm">
					<tr>
						<td class="content-n">账户类别：</td>
						<td class="content-d">
							<select class="form-control" name="fac_account_type">
								<option value="">请选择账户类别</option>
								<option value="1">公账</option>
								<option value="2">私账</option>
							</select>
						</td>
						<script>$("select[name='fac_account_type'] option[value='<?php echo $result["fac_account_type"];?>']").attr("selected",true);</script>
					</tr>
					<tr>
						<td class="content-n">卡号/账号：</td>
						<td class="content-d">
							<input type="text" name="fac_bankcard" value="<?php echo $result['fac_bankcard']?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">开户银行：</td>
						<td class="content-d">
							<select class="form-control" name="fac_bankinfo">
								<option value="">请选择开户银行</option>
								<?php
									foreach ($array_bankname as $key => $value) 
									{
										if ($value['id'] == $result['fac_bankinfo']) 
										{
											echo "<option value=" . $value['id'] . " selected>" . $value['bank_name'] . "</option>";
										}
										else
										{
											echo "<option value='".$value['id']."'>".$value['bank_name']."</option>";
										}
									}
								?>
							</select>
						</td>
					</tr>
					<tr>
						<td class="content-n">支行：</td>
						<td class="content-d">
							<input type="text" name="fac_branchbank" value="<?php echo $result['fac_branchbank']?>" />
						</td>
					</tr>
					<tr>
						<td class="content-n">开户名：</td>
						<td class="content-d">
							<input type="text" name="fac_account_name" value="<?php echo $result['fac_account_name']?>" />
						</td>
					</tr>
					<tr>
						<td class="addButton" colspan="2">
							<input type="submit" class='save' value ="保存" >
							<input type='button' value='重置'  class='clear' onclick='window.location.reload();'>
						</td>
					</tr>
				</table>
			</form>
		</div>

		<div title="分期首付 & 利率" style="padding:10px">
			<form action="../../facilitator/facilitator/downpayment_submit" method="post" id="form_downpayment">
				<input type="hidden" name="downpayment" value="<?php echo $data; ?>">
				<input type="hidden" name="facilitator_info_id" value="<?php echo $facilitator_info_id; ?>">
				<h1>分期首付 & 利率</h1>
				<table class="addForm">
					<tr>
						<td class="content-n">有无首付是否采取不同利率：</td>
						<td class="content-d">
							<select class="form-control" name="fac_payType">
								<!-- <option value="">请选择</option> -->
								<option value="1">不同</option>
							</select>
						</td>
						<script>$("select[name='fac_payType'] option[value='<?php echo $result["fac_payType"];?>']").attr("selected",true);</script>
					</tr>
					<tr>
						<td class="content-n">计算方法：</td>
						<td class="content-d">
							<select onchange="changeRateType(this);" class="form-control" name="fac_rate_method">
								<option value="">请选择</option>
								<option value="1">商户特定利率</option>
								<option value="2">个人浮动利率</option>
								<option value="3">商户自选利率</option>
							</select>
						</td>
						<script>$("select[name='fac_rate_method'] option[value='<?php echo $result["fac_rate_method"];?>']").attr("selected",true);</script>
					</tr>
					<tr id="regularRate" style="display: none">
						<td class="content-n">固定利率：</td>
						<td class="content-d">
							<input type="text" onblur="tableRate(this);" name="rate" />
						</td>
					</tr>

					<tr id="thirdRate" style="display: none">
						<td class="content-n">利率范围：</td>
						<td class="content-d">
							<input type="text" name="min_rate" value="<?php echo $array_selfrate['min_rate'];?>">------
						</td>
						<td class="content-d">
							<input type="text" name="max_rate" value="<?php echo $array_selfrate['max_rate'];?>">
						</td>
					</tr>
					<tr>
						<td class="addButton" colspan="2">
							<input type="submit" class='save' value ="保存" >
							<input type='button' value='重置'  class='clear' onclick='window.location.reload();'>
						</td>
					</tr>
				</table>

				<div id="nodown_payment" style="display: none;">
					<br/><HR width="100%" color=black /><br/>
					<span  style="font-size: 15pt">无首付</span>
					<table class="listrate" id="tableRate1" cellspacing="0" cellpadding="0">
						<tr>
							<th>期数</th>
							<th> 2000-10000</th>
							<th> 10000-20000</th>
							<th> 20000-30000</th>
							<th> 30000-50000</th>
						</tr>
						<?php
							$period = array("6","9","12","18","24");
							for ($i=0; $i < count($period); $i++) 
							{ 
						?>
						<tr>
							<th><?php echo $period[$i]; ?></th>
							<td><input type="text"  name="nodown_payment[]" class="nodown_payment" value="<?php echo $array_rate[$i*4]['value']; ?>"></td>
							<td><input type="text"  name="nodown_payment[]" class="nodown_payment" value="<?php echo $array_rate[$i*4+1]['value']; ?>"></td>
							<td><input type="text"  name="nodown_payment[]" class="nodown_payment" value="<?php echo $array_rate[$i*4+2]['value']; ?>"></td>
							<td><input type="text"  name="nodown_payment[]" class="nodown_payment" value="<?php echo $array_rate[$i*4+3]['value']; ?>"></td>
						</tr>
						<?php
							}
						?>
					</table>
				</div>
				
				<div id="down_payment" style="display: none;">
					<br/><HR width="100%" color=black /><br/>
					<span style="font-size: 15pt">有首付</span>
					<span style="margin-left: 20px">是否与无首付相等<input type="checkbox" onclick="identicalRate(this);"/></span>
					<table class="listrate" id="tableRate2" cellspacing="0" cellpadding="0">
						<tr>
							<th>期数</th>
							<th> 2000-10000</th>
							<th> 10000-20000</th>
							<th> 20000-30000</th>
							<th> 30000-50000</th>
						</tr>
						<?php
							$period = array("6","9","12","18","24");
							for ($i=0; $i < count($period); $i++) 
							{ 
						?>
						<tr>
							<th><?php echo $period[$i]; ?></th>
							<td><input type="text"  name="down_payment[]" class="down_payment" value="<?php echo $array_rate[$i*4+20]['value']; ?>"></td>
							<td><input type="text"  name="down_payment[]" class="down_payment" value="<?php echo $array_rate[$i*4+21]['value']; ?>"></td>
							<td><input type="text"  name="down_payment[]" class="down_payment" value="<?php echo $array_rate[$i*4+22]['value']; ?>"></td>
							<td><input type="text"  name="down_payment[]" class="down_payment" value="<?php echo $array_rate[$i*4+23]['value']; ?>"></td>
						</tr>
						<?php
							}
						?>
					</table>
				</div>
			</form>
		</div>

		<div title="商户特定利率" style="padding:10px">
			<form action="../../facilitator/facilitator/rateinfo_submit" method="post" id="form_rateinfo">
				<input type="hidden" name="rateinfo" value="<?php echo $data; ?>">
				<input type="hidden" name="facilitator_info_id" value="<?php echo $facilitator_info_id; ?>">
				<h1>商户特定利率</h1>
				<table class="addForm">
					<tr>
						<td class="content-n">分期期限：</td>
						<td class="content-d">
							<select class="form-control" name="fac_period_type">
								<option value="">请选择</option>
								<option value="1">商户输入</option>
								<option value="2">用户选择</option>
							</select>
						</td>
						<script>$("select[name='fac_period_type'] option[value='<?php echo $result["fac_period_type"];?>']").attr("selected",true);</script>
					</tr>
					<tr>
						<td class="content-n">存在延期：</td>
						<td class="content-d">
							<select class="form-control" onchange="isdelay(this);" name="fac_delay">
								<option value="">请选择</option>
								<option value="1">是</option>
								<option value="2">否</option>
							</select>
						</td>
						<script>$("select[name='fac_delay'] option[value='<?php echo $result["fac_delay"];?>']").attr("selected",true);</script>
					</tr>
					<tr>
						<td class="content-n">延期上限：</td>
						<td class="content-d">
							<select class="form-control" id="delayTime" disabled="disabled" name="fac_delay_id">
								<option value="0">请选择</option>
								<?php
									foreach ($array_utildelay as $key => $value) 
									{
										if ($value['id'] == $result['fac_delay_id']) 
										{
											echo "<option value=" . $value['id'] . " selected='selected'>" . $value['delay_month'] . " 月</option>";
										}
										else
										{
											echo "<option value='".$value['id']."'>".$value['delay_month']." 月</option>";
										}
									}
								?>
							</select>
						</td>
					</tr>
					<tr>
						<td class="addButton" colspan="2">
							<input type="submit" class='save' value ="保存" >
							<input type='button' value='重置'  class='clear' onclick='window.location.reload();'>
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>

	<script type="text/javascript">
		$(document).ready(function() 
		{
			$("select[name='fac_delay']").change();
			$("select[name='fac_rate_method']").change();
		});

		//	省份城市联动
		$("#city").citySelect({required:false,prov:'<?php echo $result['fac_province'];?>',city:'<?php echo $result['fac_city'];?>'});

		//	动态选择#####商户特定利率
		function isdelay(obj) 
		{
			var value = obj.value;
			if(value != 1) 
			{
				$("#delayTime").attr("disabled","disabled");
			}
			else
			{
				$("#delayTime").removeAttr("disabled","disabled");
			}
		}

		//	动态选择#####根据不同类型的利率计算方式
		function changeRateType(obj) 
		{
			var value = obj.value;
			if(value == 1) 
			{
				$("#regularRate").css("display","table-row");
				$("#thirdRate").css("display","none");
				$("#nodown_payment").css("display","block");
				$("#down_payment").css("display","block");
			}
			else if(value == 3) 
			{
				$("#regularRate").css("display","none");
				$("#thirdRate").show();
				$("#nodown_payment").css("display","none");
				$("#down_payment").css("display","none");
			}
			else 
			{
				$("#regularRate").css("display","none");
				$("#thirdRate").css("display","none");
				$("#nodown_payment").css("display","none");
				$("#down_payment").css("display","none");
			}
		}

		//	固定利率填充
		function tableRate(obj) 
		{
			var value = obj.value;
			if(value!='') 
			{
				$(".nodown_payment").val(value);
				$(".down_payment").val(value);
			}
		}

		//	是否与无首付相等填充
		function identicalRate(obj) 
		{
			if(obj.checked) 
			{
				$(".nodown_payment").each(function(index) 
				{
					$(".down_payment").eq(index).val($(this).val());
				});
			}
		}
	</script>
</body>
</html>